package com.ice.work.moment.user.dao.resource;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ice.work.moment.facade.user.model.Resource;
import com.ice.work.moment.facade.user.request.PageResourceRequest;
import org.apache.ibatis.annotations.Param;

import java.util.Collection;
import java.util.List;

/**
 * @Description resource mapper
 * @Author DELL
 * @Create 2019-01-10
 * @Since 1.0.0
 */
public interface IResourceMapper extends BaseMapper<Resource> {
    /**
     * 通过ID列表查询角色
     *
     * @param ids
     * @return
     */
    List<Resource> findByRoleIdIn(Collection<Long> ids);

    /**
     * 通过角色Id查询资源权限
     *
     * @param roleId
     * @return
     */
    List<Resource> findByRoleId(Long roleId);

    /**
     * 分页查询资源
     * @param page
     * @param resourceRequest
     * @return
     */
    Page<Resource> page(IPage<Resource> page, @Param("request") PageResourceRequest resourceRequest);
}
